% IRFIN.m
%
% Date Created: 5-May-2008
% Last Modified: 3-June-2011
% Last Modified by: Mariano Kulish
%
% NOTE: Needs solution matrices from SMATS.m for final structure
%       Requires IRFSIM.m to be run before 



[n l] = size(PSI);
% Set options
% up_to = 16; % Horizon of the response is set in IRFSIM.m
shocks = l;

% Note: recall to set Standard deviation to the same values as in IRFINI.m
% and IRFSIM.m

% Set in IRFSIM.m
% siga =  1;                % Standard deviation of innovation to the demand process.
% sige =  1;                % Standard deviation of innovation to the mark_up process. 
% sigz =  1;                % Standard deviation of innovation to the technology process. 
% sigr =  1;                % Standard deviation of innovation to the interest rate. 

Omega = [siga  0   0    0;
          0  sige  0    0;
          0    0  sigz  0;
          0    0    0   sigr];

imp = Omega;
time = 1:up_to;


yirffin_1 = zeros(n,up_to);

% Impulse response to ea(t)
yirffin_1(:,1) = inv(eye(n)-S1_f)*S0_f + S2_f*imp(:,1);
for t = 1:(up_to-1)
    yirffin_1(:,t+1) = S0_f + S1_f*yirffin_1(:,t);
end

%% Transformation of Units
% For shock 1
output_resp_fin_1 = yirffin_1(1,:);
g_resp_fin_1 = 400*yirffin_1(4,:);
inflation_resp_fin_1 = yirffin_1(2,:)*400;
r_resp_fin_1 = yirffin_1(3,:)*400;
inflationE_resp_fin_1 = yirffin_1(6,:)*400;
realr_resp_fin_1 = r_resp_fin_1 - inflationE_resp_fin_1;

